<template>
	<view
			:style="{padding:'20px'}"
	>
		<view v-if="hasLogin">
			已登录<br>
			id:{{user.id}}<br>
			token:{{user.token}}<br>
			name:{{user.user_nicename}}<br>
			<button type="primary" :style="{margin:'20px'}" @click="enterLive">进入直播</button>
			
			<button type="primary" :style="{margin:'20px 20px 0'}" @click="reLogin">重新登录</button>
		</view>
		<view v-else>
			未登录<br>
			<button type="primary" :style="{margin:'60px 20px 0'}" @click="toLogin">去登录</button>
		</view>
		
		<button type="primary" :style="{margin:'60px 20px 0'}" @click="toYYEva">YYEva</button>
		<button type="primary" :style="{margin:'60px 20px 0'}" @click="toVap">vap</button>
	</view>
</template>

<script>
    import RouteUtil from "../../utils/js/route-util";

    export default {
        name: "checkLogin",
        data() {
            return {
                user: undefined
            }
        },
        computed: {
            hasLogin() {
                return this.user !== undefined&& this.user !==''
            }
        },
        methods: {
            enterLive() {
                RouteUtil.forward(RouteUtil.LIVE_CHOOSE_SDK)
            },
            toLogin() {
                RouteUtil.forward(RouteUtil.LOGIN)
            },

            reLogin(){
                uni.clearStorageSync()
                RouteUtil.forward(RouteUtil.LOGIN)
            },
            toYYEva(){
                RouteUtil.forward('/pages/live/yyeva')
            },
            toVap(){
                RouteUtil.forward('/pages/live/txvap')
            }
        },
        mounted() {
            this.user = uni.getStorageSync('user')
        }

    }
</script>

<style scoped>

</style>
